home *** CD-ROM | disk | FTP | other *** search
- Path: ciril.fr!usenet
- From: Lotfi BAGHLI <baghli@green-uhp.u-nancy.fr>
- Newsgroups: comp.lang.c,comp.lang.c++,comp.lang.c++.leda
- Subject: Common var Pbs
- Date: Mon, 01 Apr 1996 15:18:04 -0800
- Organization: GREEN-UHP
- Message-ID: <3160642C.7606@green-uhp.u-nancy.fr>
- NNTP-Posting-Host: moorea.green-uhp.u-nancy.fr
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (Win16; I)
-
- Hi,
-
- I have problems when linking 3 cpp files which use common
- variables and constants
- in a BC++4.5 / OWL 2.5 application :
-
- A:
- ------ A.H
- --------enum Jour { Lundi, Mardi, Mercredi, ... ,
- Dimanche };
- HBITMAP JourImage[Dimanche+1][4];
- const int Periode[Dimanche+1]={ 4, 2, 0, 4,
- 4, 4, 0};
- const char * JourName[Dimanche+1]= { "Lundi",
- "Mardi", ..., "Dimanche" };
-
- class TJour {...};
- typedef TIArrayAsVector <TJour>
- TJourCollection;
-
- A.CPP
- --------#include "A.H"
- methods of TJour ...
-
- B:
- ------ B.H
- --------#include "A.H"
- class TMyMDIChild : public TMDIChild
- {
- ...
- TJourCollection * Semaine;
- ...
- };
-
- B.CPP
- --------#include "B.H"
- methods of TMyMDIChild ...
-
- C:
- ------ C.H
- --------class TMyMDIClient : public TMDIClient {...};
-
- C.CPP
- --------#include "B.H"
- methods of TMyMDIClient ...
- class TMyApplication : public TApplication
- ... + methods ...
- C.rc
- -------- menu, bitmaps ...
- C.ide
- --------A.CPP
- B.CPP
- C.CPP
- C.RC
-
- The linking generates errors :
- _JourImage defined in module A.CPP is duplicated in module
- B.CPP
- _JourName defined in module A.CPP is duplicated in module
- B.CPP
-
- I want to use the (same) enums, variables and constants in
- the three A, B and C files.
-
- I also want to declare the variables in the .CPP instead of
- .H to enable the
- use of precompiled headers.
-
- I don't know how to do " extern " declarations with arrays
- and constant arrays.
-
- Please feel free to contact me if you have any suggestion.
-
- Thanks a lot.
- ---------------------------
- Lotfi BAGHLI
- baghli@green-uhp.u-nancy.fr
-